<!--#include file="../../../inc/AspCms_MainClass.asp" -->
<%
CheckAdmin("AspCms_Slide.asp")
dim action : action=getForm("action", "get")
Select Case action
	Case "save"	 : Call saveService()
End Select 
	
Sub saveService
	dim templateobj,configStr,configPath
	
	
	if not isnum(getForm("slideNum","post")) then alertMsgAndGo "幻灯片个数不正确","-1"
	configPath="../../../config/AspCms_Config.asp"
	set templateobj=new TemplateClass
	configStr=loadFile(configPath)
	configStr=templateobj.regExpReplace(configStr,"Const slideTextStatusC=(\d?)","Const slideTextStatusC="&getForm("slideTextStatus","post")&"")
	configStr=templateobj.regExpReplace(configStr,"Const slideNumC=([\d]*)","Const slideNumC="&getForm("slideNum","post")&"")
	
	configStr=templateobj.regExpReplace(configStr,"Const slideWidthC=""(\S*?)""","Const slideWidthC="""&getForm("slideWidth","post")&"""")
	
	configStr=templateobj.regExpReplace(configStr,"Const slideHeightC=""(\S*?)""","Const slideHeightC="""&getForm("slideHeight","post")&"""")
	configStr=templateobj.regExpReplace(configStr,"Const slideTextsC=""([\s\S]*?)""","Const slideTextsC="""&setText(getForm("slideNum","post"),getForm("slideTexts","post"))&"""")
	configStr=templateobj.regExpReplace(configStr,"Const slideLinksC=""([\s\S]*?)""","Const slideLinksC="""&setText(getForm("slideNum","post"),getForm("slideLinks","post"))&"""")
	configStr=templateobj.regExpReplace(configStr,"Const slidestyleC=(\d?)","Const slidestyleC="&getForm("slidestyle","post")&"")
	configStr=templateobj.regExpReplace(configStr,"Const slideImgsC=""([\s\S]*?)""","Const slideImgsC="""&setText(getForm("slideNum","post"),getForm("slideImgs","post"))&"""")
	'die configStr
	'die "Const slideImgs="""&setText(getForm("slideNum","post"),getForm("slideImgs","post"))&""""
	
	createTextFile configStr,configPath,"utf-8"
	set templateobj=nothing
	alertMsgAndGo "修改成功",getPageName()
	
End Sub


Function setText(num,text)
	dim i 
	text=split(text,",")
	for i=0 to num-1
		if ubound(text)+1>i then
			setText=setText&text(i)&","
		else			
			setText=setText&","
		end if	
	next
End Function


%>

<!DOCTYPE html>
<html lang="zh-CN" style="min-height: 100%;">
<head>
<title>OnlineService</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />

<link href="https://cdn.bootcss.com/uikit/3.0.0-beta.22/css/uikit.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/jquery.perfect-scrollbar/0.7.0/css/perfect-scrollbar.min.css" rel="stylesheet">
<link href="../../css/timoo/fancySelect.css" rel="stylesheet">
<link href="../../css/timoo/timoo.css" rel="stylesheet">

<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/uikit/3.0.0-beta.22/js/uikit.min.js"></script>
<script src="https://cdn.bootcss.com/uikit/3.0.0-beta.22/js/uikit-icons.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.perfect-scrollbar/0.7.0/js/perfect-scrollbar.jquery.min.js"></script>
<script src="../../js/timoo/icheck.min.js"></script>
<script src="../../js/timoo/fancySelect.js"></script>
<script src="../../js/timoo/timoo.js"></script>
</head>
<body>
<div class="tm-right">
    <div class="main">
        <form name="form" action="?action=save" method="post" >
            <div class="section setting-company">
                <div class="layout">
                    <div class="title">幻灯片管理</div>
                    <div class="content">
                        <div class="operation">
                            <ul class="uk-clearfix">
                                <li class="uk-float-left">
                                    <input onClick="location.href='AspCms_Slide.asp'" type="button" value="幻灯片A">
                                </li>
                                <li class="uk-float-left">
                                    <input onClick="location.href='AspCms_SlideB.asp'" type="button" value="幻灯片B">
                                </li>
                                <li class="uk-float-left on">
                                    <input onClick="location.href='AspCms_SlideC.asp'" type="button" value="幻灯片C">
                                </li>
                                <li class="uk-float-left">
                                    <input onClick="location.href='AspCms_SlideD.asp'" type="button" value="幻灯片D">
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="layout">
                    <div class="title">幻灯片设置</div>
                    <div class="content">
                        <div class="tm-transition list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">幻灯片个数</span>
                            </div>
                            <div class="input">
                                <input type="text" maxLength="2" name="slideNum" value="<%=slideNumC%>">
                            </div>
                        </div>
                        <div class="tm-transition list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">幻灯片宽度</span>
                                <i class="tm-transition icon" uk-icon="icon: info" uk-tooltip="pos: right" title="请输入 数值 + 单位。（单位为 px 或 %； 例：1920px 或者 100%）"></i>
                            </div>
                            <div class="input">
                                <input type="text" name="slideWidth" value="<%=slideWidthC%>">
                            </div>
                        </div>
                        <div class="tm-transition list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">幻灯片高度</span>
                                <i class="tm-transition icon" uk-icon="icon: info" uk-tooltip="pos: right" title="请输入 数值 + 单位。（单位为 px 或 %； 例：1920px 或者 100%）"></i>
                            </div>
                            <div class="input">
                                <input type="text" name="slideHeight" value="<%=slideHeightC%>">
                            </div>
                        </div>
                        <div class="tm-transition radio list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">文字说明</span>
                            </div>
                            <div class="uk-clearfix input">
                                <label for="Slide-Text-Display" class="uk-clearfix uk-float-left tm-transition">
                                    <span class="uk-float-left check">
                                        <i class="tm-transition icon" uk-icon="icon: check"></i>
                                    </span>
                                    <span class="uk-float-left">显示</span>
                                    <input id="Slide-Text-Display" type="radio" value="1" name="slideTextStatus" <% if slideTextStatusC=1 then echo "checked" end if%>>
                                </label>
                                <label for="Slide-Text-Hidden" class="uk-clearfix uk-float-left tm-transition">
                                    <span class="uk-float-left check">
                                        <i class="tm-transition icon" uk-icon="icon: check"></i>
                                    </span>
                                    <span class="uk-float-left">隐藏</span>
                                    <input id="Slide-Text-Hidden" type="radio" value="0" name="slideTextStatus" <% if slideTextStatusC=0 then echo "checked" end if%>>
                                </label>
                            </div>
                        </div>
                        <div class="tm-transition list picture-list radio">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">幻灯样式</span>
                            </div>
                            <div class="picture-box">
                                <div uk-grid>
                                    <div id="Img-1" class="uk-width-1-6 image-box" data-image="Imag-1">
                                        <div class="box">
                                            <a class="uk-cover-container"><img src="" uk-cover></a>
                                            <div class="uk-clearfix images-control">
                                                <div class="uk-float-left images-input">
                                                    <label for="Images-1" class="uk-clearfix uk-float-left tm-transition">
                                                        <input id="Images-1" type="radio" value="0" name="slidestyle" <% if slidestyleC=0 then echo "checked" end if%>>
                                                        <span class="text">使用该样式</span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="Img-2" class="uk-width-1-6 image-box" data-image="Imag-2">
                                        <div class="box">
                                            <a class="uk-cover-container"><img src="../../images/slide1.jpg" uk-cover></a>
                                            <div class="uk-clearfix images-control">
                                                <div class="uk-float-left images-input">
                                                    <label for="Images-2" class="uk-clearfix uk-float-left tm-transition">
                                                        <input id="Images-2" type="radio" value="1" name="slidestyle" <% if slidestyleC=1 then echo "checked" end if%>>
                                                        <span class="text">使用该样式</span>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tm-transition list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">调用标签</span>
                            </div>
                            <div class="input">
                                <input type="text" maxLength="200" value="{aspcms:slidec}" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <%
                   Dim slideImg,slideLink,slideText,i,imgstr
                   slideImg = split(slideImgsC,",")
                   slideLink = split(slideLinksC,",")
                   slideText = split(slideTextsC,",")
                   
                   for i=0 to slideNumC-1			
                       imgstr="<img id=img"&i&" src='"&trim(slideImg(i))&"' uk-cover>"
                %>
                <div class="layout">
                    <div class="title">幻灯片图片<%=i+1%></%%></div>
                    <div class="content">
                        <div class="tm-transition list radio">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">图片预览</span>
                            </div>
                            <div class="uk-cover-container full-image">
                                <%=imgstr%>
                            </div>
                        </div>
                        <div class="tm-transition input list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">图片地址</span>
                            </div>
                            <div class="uk-clearfix input">
                                <input type="text" name="slideImgs" id="ImagePath<%=i%>" value="<%=trim(slideImg(i))%> ">
                            </div>
                        </div>
                        <div class="tm-transition list have upload picture-upload">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">上传图片</span>
                            </div>
                            <div class="input">
                                <iframe src="../../editor/upload.asp?sortType=12&stype=file&Tobj=ImagePath<%=i%>&toimg=img<%=i%>" scrolling="No" topmargin="0" width="100%" height="40" marginwidth="0" marginheight="0" frameborder="0"></iframe>
                            </div>
                        </div>
                        <div class="tm-transition input list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">链接地址</span>
                                <i class="tm-transition icon" uk-icon="icon: info" uk-tooltip="pos: right" title="空链接请填写 “#” 。"></i>
                            </div>
                            <div class="uk-clearfix input">
                                <input type="text" name="slideLinks"  value="<%=trim(slideLink(i))%>">
                            </div>
                        </div>
                        <div class="tm-transition input list">
                            <div class="uk-clearfix tm-transition subject">
                                <span class="uk-float-left">说明文字</span>
                            </div>
                            <div class="uk-clearfix input">
                                <input type="text" name="slideTexts" value="<%=trim(slideText(i))%>">
                            </div>
                        </div>
                    </div>
                </div>
                <% next %>
                <div class="layout">
                    <div class="title">保存更改</div>
                    <div class="content">
                        <div class="uk-clearfix tm-transition list submit">
                            <div class="uk-float-left input">
                                <input type="submit" value="保存">
                            </div>
                            <div class="uk-float-left input">
                                <input type="button" value="返回" onClick="history.go(-1)"> 
                            </div>
                            <div class="uk-float-left input">
                                <INPUT onClick="location.href='<%=getPageName()%>'" type="button" value="刷新"> 
                            </div>
                        </div>
                    </div>
                </div>   
            </div>
        </form>
    </div>
</div>
</body>
</html>